package lab03.test08;

import java.io.*;

public class Test08 {
    public static void main(String[] args) {
        File file = new File("E:\\test1.txt");
        try {
            file.createNewFile();
        } catch (IOException e) {
            e.printStackTrace();
        }
        FileInputStream fileInputStream = null;
        FileOutputStream fileOutputStream = null;
        FileInputStream fileInput = null;
        try {
            fileInputStream = new FileInputStream("E:\\test1.txt");
            fileInput = new FileInputStream("E:\\test2.txt");
            fileOutputStream = new FileOutputStream("E:\\test3.txt");
            int ch;
            int c;
            while ((ch = fileInputStream.read()) != -1 | (c = fileInput.read()) != -1) {
                fileOutputStream.write(ch);
                fileOutputStream.write(c);
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                fileInputStream.close();
                fileInput.close();
                fileOutputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }

        }
    }
}
